#include <jni.h>
#include <iostream>

#include "PrintFuncs.h"

using namespace std;

JNIEXPORT void JNICALL Java_PrintFuncs_printStringNative(JNIEnv *env, jobject obj, jstring s) {
	const char *str = env->GetStringUTFChars(s, NULL);
	
	jclass cls = env->GetObjectClass(obj);
	jmethodID mid = env->GetMethodID(cls, "printStringJava", "(Ljava/lang/String;)V");

	jstring msg = env->NewStringUTF(str);

	env->CallVoidMethod(obj, mid, msg);
	env->ReleaseStringUTFChars(msg, str);
}
